package mof.gov.dmdc.view.backing;

import mof.gov.dmdc.view.common.Common;

import oracle.adf.view.rich.component.rich.layout.RichShowDetailItem;

import org.apache.myfaces.trinidad.event.DisclosureEvent;

public class WebStatus {
    private int disclosedGroup = 0;

    public void setDisclosedGroup(int disclosedGroup) {
        this.disclosedGroup = disclosedGroup;
    }

    public int getDisclosedGroup() {
        return disclosedGroup;
    }

    public void mlnsDisListener(DisclosureEvent disclosureEvent) {
        RichShowDetailItem item = (RichShowDetailItem)disclosureEvent.getComponent();
        if (item.isDisclosed() == true) {
            disclosedGroup = 1;
            Common.refreshComponent(disclosureEvent.getComponent().getParent());
        }
    }

    public void bcctDisListener(DisclosureEvent disclosureEvent) {
        RichShowDetailItem item = (RichShowDetailItem)disclosureEvent.getComponent();
        if (item.isDisclosed() == true) {
            disclosedGroup = 2;
            Common.refreshComponent(disclosureEvent.getComponent().getParent());
        }
    }

    public void cqdvDisListener(DisclosureEvent disclosureEvent) {
        RichShowDetailItem item = (RichShowDetailItem)disclosureEvent.getComponent();
        if (item.isDisclosed() == true) {
            disclosedGroup = 3;
            Common.refreshComponent(disclosureEvent.getComponent().getParent());
        }
    }

    public void coaDisListener(DisclosureEvent disclosureEvent) {
        RichShowDetailItem item = (RichShowDetailItem)disclosureEvent.getComponent();
        if (item.isDisclosed() == true) {
            disclosedGroup = 4;
            Common.refreshComponent(disclosureEvent.getComponent().getParent());
        }
    }

    public void nstlDisListener(DisclosureEvent disclosureEvent) {
        RichShowDetailItem item = (RichShowDetailItem)disclosureEvent.getComponent();
        if (item.isDisclosed() == true) {
            disclosedGroup = 5;
            Common.refreshComponent(disclosureEvent.getComponent().getParent());
        }
    }

    public void otherDisListener(DisclosureEvent disclosureEvent) {
        RichShowDetailItem item = (RichShowDetailItem)disclosureEvent.getComponent();
        if (item.isDisclosed() == true) {
            disclosedGroup = 6;
            Common.refreshComponent(disclosureEvent.getComponent().getParent());
        }
    }

    public void oldDisListener(DisclosureEvent disclosureEvent) {
        RichShowDetailItem item = (RichShowDetailItem)disclosureEvent.getComponent();
        if (item.isDisclosed() == true) {
            disclosedGroup = 7;
            Common.refreshComponent(disclosureEvent.getComponent().getParent());
        }
    }

    public void extraDisListener(DisclosureEvent disclosureEvent) {
        RichShowDetailItem item = (RichShowDetailItem)disclosureEvent.getComponent();
        if (item.isDisclosed() == true) {
            disclosedGroup = 8;
            Common.refreshComponent(disclosureEvent.getComponent().getParent());
        }
    }

    public String goHomeAction() {
        disclosedGroup = 0;
        return "adfMenu_home";
    }
    
    public String goDownloadAction() {
        disclosedGroup = 0;
        return "adfMenu_taifiletinh";
    }

    public void toChucNgoaiNganhDisListener(DisclosureEvent disclosureEvent) {
        RichShowDetailItem item = (RichShowDetailItem)disclosureEvent.getComponent();
        if (item.isDisclosed() == true) {
            disclosedGroup = 9;
            Common.refreshComponent(disclosureEvent.getComponent().getParent());
        }
    }

    public void quocGiaTienTeDisListenner(DisclosureEvent disclosureEvent) {
        RichShowDetailItem item = (RichShowDetailItem)disclosureEvent.getComponent();
        if (item.isDisclosed() == true) {
            disclosedGroup = 10;
            Common.refreshComponent(disclosureEvent.getComponent().getParent());
        }
    }
}
